package com.futer.ssm.service.impl;

import com.futer.ssm.dao.CommentMapper;
import com.futer.ssm.dao.ItemMapper;
import com.futer.ssm.model.Comment;
import com.futer.ssm.model.CommentExample;
import com.futer.ssm.model.Item;
import com.futer.ssm.model.ItemExample;
import com.futer.ssm.service.ItemService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ItemImpl implements ItemService {

    @Resource
    private ItemMapper itemMapper;

    @Resource
    private CommentMapper commentMapper;


    @Override
    public List<Item> getAllList(ItemExample itemExample) {
        return itemMapper.selectByExample(itemExample);
    }

    @Override
    public Item getItem(String name) {
        return itemMapper.selectByPrimaryKey(name);
    }

    @Override
    public List<Comment> getAllComment(CommentExample commentExample) {
        return commentMapper.selectByExample(commentExample);
    }

    @Override
    public int updateItem(Item item) {
        return itemMapper.updateByPrimaryKeySelective(item);
    }
}
